/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//package javaapplication1;

import vectors.LinkedListVector;

import java.io.*;


/**
 * @author s32465
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
//
        //Vector vec = new LinkedListVector(5);

        //ReadVectorThread read= new ReadVectorThread(vec);
        //WriteVectorThread write = new WriteVectorThread(vec);
        //WriteVectorThread write1 = new WriteVectorThread(vec);

        //read.setPriority(Thread.MIN_PRIORITY);
        //write.setPriority(Thread.MAX_PRIORITY);
        //write1.setPriority(Thread.MIN_PRIORITY);
        //read.start();
        /*
        write.start();
        try {
            write.wait(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        */
        //write1.start();

//        //====================== 2=================
//        WaitReadWrite rw = new WaitReadWrite();
//        ReadVectorRunnable read = new ReadVectorRunnable(vec);
//        WriteVectorRunnable write = new WriteVectorRunnable(vec);
//        Thread readThread = new Thread(read);
//        Thread writeThread = new Thread(write);
//
//        writeThread.setPriority(Thread.NORM_PRIORITY);
//        readThread.setPriority(Thread.NORM_PRIORITY);
//
//        writeThread.start();
//        readThread.start();
//        //===========================================
//        try {
//            BufferedReader dataFile = new BufferedReader(new FileReader("data.txt"));
//            //BufferedWriter dataFileWrite = new BufferedWriter(new FileWriter("result.txt"));
//            //BufferedWriter resultFile = new BufferedWriter(new FileWriter("result.txt"));
//            //dataFileWrite.write("test string");
//            //dataFileWrite.close();
//            //dataFileWrite.write("test string");
//            String resultVector;
//            resultVector = dataFile.readLine();
//            System.out.println("dataFile = " + resultVector);
//            //resultFile.write("test");
//
//
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
        //File configFile = new File("result.txt");

        try {
            BufferedReader dataFile = new BufferedReader(new FileReader("data.txt"));
            BufferedWriter resultFile = new BufferedWriter(new FileWriter("result.txt"));

            String resultVector = dataFile.readLine();
            resultFile.write(resultVector);

            dataFile.close();
            resultFile.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (IOException e) {
            System.out.println("Program can not create configuration file.");
        }


    }
}
